package com.futureCloudMOM.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.futureCloudMOM.core.base.service.BaseService;
import com.futureCloudMOM.core.base.service.impl.BaseServiceImpl;
import com.futureCloudMOM.core.domain.BasicEmployee;
import com.futureCloudMOM.core.mapper.BasicEmployeeMapper;
import com.futureCloudMOM.core.service.BasicEmployeeService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 【Basic_Employee】的数据库操作Service实现
*
* @author Administrator
* @since 2023-06-06 15:19:29
*/
@Service
public class BasicEmployeeServiceImpl extends BaseServiceImpl<BasicEmployeeMapper, BasicEmployee> implements BasicEmployeeService {

    @Override
    public List<BasicEmployee> getEmployeeByNameAndCode(BasicEmployee basicEmployee) {
        return list(new LambdaQueryWrapper<BasicEmployee>()
        .eq(BasicEmployee::getDeleted,0)
        .like(ObjectUtils.isNotEmpty(basicEmployee.getName()),BasicEmployee::getName,basicEmployee.getName())
        .like(ObjectUtils.isNotEmpty(basicEmployee.getCode()),BasicEmployee::getCode,basicEmployee.getCode())
        .orderByDesc(BasicEmployee::getSysCreateTime)
        );
    }
}
